First commit, took program from Marco, fixed some bugs and implement input/output file